package com.woniu.new_orange.customization_model_zhang.controller;

import com.woniu.new_orange.customization_model_zhang.service.BulletTrainService;
import com.woniu.new_orange.customization_model_zhang.vo.AirTicketVo;
import com.woniu.new_orange.customization_model_zhang.vo.BulletTrainVo;
import com.woniu.new_orange.entity.AirTicket;
import com.woniu.new_orange.entity.BulletTrain;
import com.woniu.new_orange.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Program: new_orange->BulletTrainConfig
 * @Description:
 * @Author: PC
 * @Date: 2023-02-07 20:23
 * @Version： 1.0
 **/
@RestController
@RequestMapping("/bullettrain")
public class BulletTrainConfig {
    @Resource
    private BulletTrainService bulletTrainService;

    @PutMapping("/submitFormTrainDo")
    public Result add(@RequestBody BulletTrain train){
        int insert = bulletTrainService.insertSelective(train);
        return Result.ok();
    }

    @GetMapping("{airTicketBy1}")
    public Result loadTrain(@PathVariable String airTicketBy1){
        int i = Integer.parseInt(airTicketBy1);
        List<BulletTrainVo> bulletTrainVos = bulletTrainService.selectAll(i);
        return Result.ok().data("AirData",bulletTrainVos);
    }
}
